/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package metro.jme.lottery.persist;

import metro.jme.lottery.util.StringUtil;

/**
 * This class acts like an interface between the RMS and the UI, it gives to the
 * UI everything it needs to be be displayed, so the UI just need to get things from
 * here and display it nothing more.
 * @author pierre
 */
public abstract class Persist {

    protected static final String DBNAME_SETS = "FAVSETS";
    protected static final String DBNAME_FAV = "FAV";

    public static void store(String[] s) throws Exception {
        SetBean.deleteAll();
        SetBean setBean;
        for (int i = 0; i < s.length; i++) {
            if (!StringUtil.isEmpty(s[i])) {
                setBean = new SetBean(s[i]);
                setBean.store();
            }
        }
    }

    public static String[] getSets() {
        SetBean[] list = SetBean.getBeans();
        String[] stringList = new String[list.length];
        for (int i = 0; i < list.length; i++) {
            stringList[i] = list[i].getValue();
        }
        return stringList;
    }
}
